import Vue from 'vue'
import VueRouter from 'vue-router'
import Layout from '../views/layout'

Vue.use(VueRouter)

// import module
import {home} from './module/home.js' // 功能入口
// 通讯录
import {myLinkMenber} from './module/addressList/myLinkMenber.js' // 通讯录---我的联系人
import {myManagement} from './module/addressList/myManagement.js' // 通讯录---我的管理
import {myTeam} from './module/addressList/myTeam.js' // 通讯录---我的团队
// 产业工人
import {industrialistWorking} from './module/industrialis/Working.js' // 产业工人---工作台
import {entrance} from './module/specialist/entrance.js' // 专家技术---入口
//数字果园
import {digitalOrchardWorking} from './module/digitalOrchard/workingTeam.js' // 数字果园---数字果园
//智能装备
import {IntelligentEquipment,IntelligentEquipment2,IntelligentEquipmenTry} from './module/IntelligentEquipment/workingTeam.js' 

export const routes = [{
		path: '/login',
		name: 'login',
		meta: {
			title: '登录',
			icon: ''
		},
		component: () => import('@/views/login/index.vue')
	},{
		path: '/signin',
		name: 'signin',
		meta: {
			title: '注册',
			icon: ''
		},
		component: () => import('@/views/login/signin/index.vue')
	},{
		path: '/signins',
		name: 'signins',
		meta: {
			title: '设置密码',
			icon: ''
		},
		component: () => import('@/views/login/signin/nextStep.vue')
	},{
		path: '/forgetthepassword',
		name: 'forgetthepassword',
		meta: {
			title: '忘记密码',
			icon: ''
		},
		component: () => import('@/views/login/forgetThePassword/index.vue')
	},{
		path: '/forgetthepasswords',
		name: 'forgetthepasswords',
		meta: {
			title: '重设密码',
			icon: ''
		},
		component: () => import('@/views/login/forgetThePassword/forgetThePassword.vue')
	},{
		path: '/await',
		name: 'await',
		meta: {
			title: '页面正在开发',
			icon: ''
		},
		component: () => import('@/views/await.vue')
	},{
		path: '/compatibility',
		name: 'compatibility',
		meta: {
			title: '不兼容此浏览器内核',
			icon: ''
		},
		component: () => import('@/views/compatibility.vue')
	},{
		path: '/editormap',
		name: 'editormap',
		meta: {
			title: '地图编辑',
			icon: ''
		},
		component: () => import('@/views/editorMap/index.vue')
	},{
		path: '/editEquipment',
		name: 'editEquipment',
		meta: {
			title: '设备编辑',
			icon: ''
		},
		component: () => import('@/components/equipment/index.vue')
	},
	{
		path: '/',
		name: 'layout',
		component: () => import('@/layout/index.vue'),
		redirect: '/index',
		children: [
			home,
			myManagement,
			myTeam,
			myLinkMenber,
			industrialistWorking,
			entrance,
			digitalOrchardWorking,
			IntelligentEquipmenTry,
			IntelligentEquipment,
			IntelligentEquipment2,
		]
	},	
	{
		path: '*',
		name: '404',
		meta: {
			title: '404',
			icon: ''
		},
		component: () => import('@/views/404.vue')
	},
]



// routes = routes.concat(classifyRouter)
// export const editRouter = reconsitution(routes)
const router = new VueRouter({
	mode: 'history',
	routes
})
const originalPush = VueRouter.prototype.replace

VueRouter.prototype.replace = function replace(location) {
  return originalPush.call(this, location).catch(err => err)

}

export default router

// 一级嵌套路由实例
/**
 * {
	path: 'management',
	name: 'management',
	component: Layout,
	meta: {
		title: '首页2',
		icon: 'el-icon-location'
	},
	children: [{
			path: "index",
			name: "defaultPage",
			component: Layout,
			meta: {
				title: '专享',
				icon: 'el-icon-location'
			}
		}
	]
}
 */
// 二级嵌套路由实例
/**
 * {
	path: 'management',
	name: 'management',
	component: Layout,
	meta: {
		title: '首页2',
		icon: 'el-icon-location'
	},
	children: [{
			path: "index",
			name: "defaultPage",
			component: Layout,
			meta: {
				title: '专享',
				icon: 'el-icon-location'
			},
			children: [{
					path: "indexall",
					name: "defaultPage123",
					component: () => import("@/views/test/index.vue"),
					hidden: true,
					meta: {
						title: '专享福利333333',
						icon: 'el-icon-location'
					}
				}
			]
		}
	]
}
 */
